#ifdef TIME_2_SKIP
#else
#include "view_time_2.h"
#include "view_time_2.inc"
#include "view_time_0.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "view_common.h"
#include "app_trace.h"
#include "view_times.h"
#include "view_time_1.h"
#define LOG(fmt, ...) // app_trace_log(fmt "\r\n", ##__VA_ARGS__)

static void view_time_2_background(void)
{
	_disp_show_flash_img(DISP_LFS_FILE_INDEX_4,0,0,FILE_IMG_data3_bg);
}

static void view_time_2_time_hand(void)
{
	  if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.com_data.i_temp[31] = (RTCGetSeconds() % 60) * 6;
        uint16_t temp16 = get_present_day_minute();
        disp_ctrl.com_data.i_temp[33] = (temp16 / 2) / 6 * 6 % 360;
        disp_ctrl.com_data.i_temp[32] = (temp16 * 6) / 6 * 6 % 360;
    }
    disp_draw_img_rotate(img_time_2_hour_hand, 0, 39 , (64 << 16) | 110, disp_ctrl.com_data.i_temp[33]);
    disp_draw_img_rotate(img_time_2_minute_hand, 0, 53, (64 << 16) | 110, disp_ctrl.com_data.i_temp[32]);
    disp_draw_img_rotate(img_time_2_second, 0, 55 , (64 << 16) | 110, disp_ctrl.com_data.i_temp[31]);
}

static void view_time_2_week(void)
{
	const uint8_t img_time_2_week_TAB[] = 
	{
		FILE_IMG_data3_font_week_30_45_1,
		FILE_IMG_data3_font_week_30_45_2,
		FILE_IMG_data3_font_week_30_45_3,
		FILE_IMG_data3_font_week_30_45_4,
		FILE_IMG_data3_font_week_30_45_5,
		FILE_IMG_data3_font_week_30_45_6,
		FILE_IMG_data3_font_week_30_45_7,
	};
	_disp_show_flash_img(DISP_LFS_FILE_INDEX_0,31,45,img_time_2_week_TAB[disp_ctrl.com_data.i_temp[5]-1]);
}

static void view_time_2_date(void)
{
	disp_draw_user_image_num_mid_gray_lucency(85,45,RGB565_COLOR_WHITE,disp_ctrl.com_data.i_temp[2],12,img_time_2_num_TAB);
}

static void view_time_2_heart_reat(void)
{
	disp_draw_user_image(53,128,img_time_2_heart_reat);
	disp_draw_user_image_num_mid_gray_lucency(64,157,RGB565_COLOR_WHITE,disp_ctrl.com_data.i_temp[17],12,img_time_2_num_TAB);
}

void view_time_2_display(void)
{
	view_time_2_background();
	view_time_2_week();
	view_time_2_heart_reat();
	view_time_2_date();
	view_time_2_time_hand();
}
#endif
